<?php
namespace app\admin\controller\v1;
use app\admin\Adminbase;

class Log extends Adminbase 
{
	
	/**
	* 获取所有访问ip-去重
	* /admin/v1/Log/getAllIp
	* 不需要登录 
	* @is_need_login true
	*/
	public function getAllIp($is_action_call=false){
		try {
			$result = model('SystemLog')
				->distinct(true)
				->field("ip as label,ip as value")
				->order('create_time desc')
				->limit(10)
				->select();
				
			if($is_action_call){
				return $result;	
			}else{
				return $this->ReSucess($result);	
			}
		} catch (\Exception $e) {
			return $this->ReError($e->getMessage());	
		}
	}
	
	
	/**
	* 清空日志
	* /admin/v1/Log/emptyAll
	* 不需要登录 
	* @is_need_login true
	*/
	public function emptyAll(){
		try {
			$result = model('SystemLog')->where('1','=','1')->delete();
			return $this->ReSucess($result);	
		} catch (\Exception $e) {
			return $this->ReError($e->getMessage());	
		}
	}
	
	
	/**
	* 清空日志
	* /admin/v1/Log/test
	* 不需要登录 
	* @is_need_login true
	*/
	public function test(){
//		dump(crmeb\subscribes\OrderSubscribe::class);
//		crmeb\subscribes\SystemSubscribe::class;
		$myarr = include "./application/event.php";
		$myarr['listen']['task_2'];
		dump($myarr['listen']['task_2']);
	}
}



